package com.atguigu.day03;

import org.apache.flink.configuration.Configuration;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.LocalStreamEnvironment;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

/**
 * @author Felix
 * @date 2024/7/10
 * 该案例演示了Flink中环境准备
 */
public class Flink01_Env {
    public static void main(String[] args) throws Exception {
        //创建本地执行环境
        //LocalStreamEnvironment env = StreamExecutionEnvironment.createLocalEnvironment();
        //创建本地执行环境  带webUI的  需要添加flink-runtime-web依赖
        //StreamExecutionEnvironment env = StreamExecutionEnvironment.createLocalEnvironmentWithWebUI(new Configuration());
        //自动获取执行环境
        //StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        //获取远程执行环境
        StreamExecutionEnvironment env
                = StreamExecutionEnvironment.createRemoteEnvironment("hadoop102", 8081, "D:\\dev\\workspace\\bigdata-0221\\target\\bigdata-0221-1.0-SNAPSHOT.jar");
        DataStreamSource<String> fileDS = env.readTextFile("/opt/module/flink-1.17.0/word.txt");
        fileDS.print();
        env.execute();
    }
}
